from typing import Optional, List
import os

AK = '2jCwbiCWReSVlPbt53f9pYhP'
SK = 'dwJ8BULLCsBMXsmtjyxNI8hkw4y0HPXq'
os.environ['QIANFAN_AK'] = AK
os.environ['QIANFAN_SK'] = SK
# from langchain_core.prompts import PromptTemplate
# from langchain_community.llms import QianfanLLMEndpoint
from langchain_core.prompts import PromptTemplate
from langchain_community.llms import QianfanLLMEndpoint

template = '我的邻居姓{lastname},他老婆生了个孩子,给孩子起个2个字的名字'
# prompt = PromptTemplate(input_variables=['lastname'],
#                         template=template
#                         )
# prompt_text = prompt.format(lastname='王')
# print(prompt_text)
# llm = QianfanLLMEndpoint()
# result = llm(prompt_text)
# print(result)
# print('*' * 90)
prompt1 = PromptTemplate.from_template(template)
prompt1_text = prompt1.format(lastname='李')
print(prompt1_text)
llm = QianfanLLMEndpoint()
print(llm(prompt1_text))
# prompt1 = PromptTemplate.from_template(template)
# prompt1_text = prompt1.format(lastname='李')
# print(prompt1_text)
# llm = QianfanLLMEndpoint()
# print(llm(prompt1_text))
